package po;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/*
*   用户持久类
* */
public class Admin {

    private Integer id;         // 主键 id

    private String avatar;          // 头像

    private String username;    // 登录名称   非空 唯一

    private String password;    // 密码

    private Byte sex;           // 性别   0 男 1 女

    private String phoneNum;    // 电话   唯一

    private String email;       // 邮箱   唯一

    private Date birth;         // 生日

    private String introduction;    // 介绍

    private String address;        // 地址

    private Byte isEnable;        // 状态

    private Role role;           // 管理员关联的权限

    private Date createTime;        // 创建时间 非空

    private Date updateTime;        // 修改时间 非空


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Byte getSex() {
        return sex;
    }

    public void setSex(Byte sex) {
        this.sex = sex;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Byte getIsEnable() {
        return isEnable;
    }

    public void setIsEnable(Byte isEnable) {
        this.isEnable = isEnable;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return "Admin{" +
                "id=" + id +
                ", avatar='" + avatar + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", sex=" + sex +
                ", phoneNum='" + phoneNum + '\'' +
                ", email='" + email + '\'' +
                ", birth=" + dateFormat.format(birth) +
                ", introduction='" + introduction + '\'' +
                ", address='" + address + '\'' +
                ", isEnable=" + isEnable +
                ", role=" + role +
                ", createTime=" + dateFormat.format(createTime) +
                ", updateTime=" + dateFormat.format(updateTime) +
                '}';
    }
}
